Ext.define('Era.view.EventsGrid',{
   extend: 'Ext.grid.Panel',
   alias: 'widget.eventsgrid',
   store: 'Events',
   
   width: 188,         
   autoHeight: true,
   maxHeight: 300,
   border: false,
   frame: true,
   hideHeaders: true,
   
   listeners: {
        itemmouseenter: function(view, record, item, index, e, options)
        {
            view.up('eventslist').fireEvent('showpreview',view,record);
        },
        itemmouseleave: function(view, record, item, index, e, options)
        {
            view.up('eventslist').fireEvent('hidepreview',view,record);
        }
   },
   
   viewConfig:{
        deferEmptyText: false,
        emptyText:'No events found.'
        
    },
   
   columns: [
        {
            header: 'Title',
            dataIndex: 'title',
            width: 100,
            menuDisabled: true
        },
        {
            header: 'Start',
            dataIndex: 'start_date',
            width: 50,
            menuDisabled: true,
            renderer: Ext.util.Format.dateRenderer('d-m-Y')
        },
        {
            xtype:'actioncolumn',  
            width:30,
            menuDisabled: true,
            items: [{
                icon: 'data/images/add.gif',
                tooltip: 'Finish Event',
                stopSelection: true,

                handler: function(grid, rowIndex, colIndex) {                       
                    var record = grid.getStore().getAt(rowIndex);
                    var el = grid.getEl();
                            
                    alert('aaa')
                    this.up('eventsgrid').fireEvent('showfinishform',record);
                }
            }]
        }
    ],
    
    dockedItems: [{
    xtype: 'toolbar',
    dock: 'bottom',
    ui: 'footer',
    border: false,
        items: [{
            text:'New event',
            icon:'data/images/add.gif',
            action: 'new_event',
            margin: '0 0 0 40'
        }]
    }]
});


